package com.miya.plugin1;

import android.app.Activity;
import android.app.Application;
import android.content.res.Resources;
import android.os.Bundle;
import android.util.Log;

import androidx.annotation.Nullable;

public abstract class PluginBaseActivity extends Activity {


    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }


    /**
     * 替代baseActivity的getResources
     * issue：1. 加载插件第一次调用时，Application是空的（为什么？）
     *
     * @return
     */
    @Override
    public Resources getResources() {
        Application app = getApplication();
        if (app == null) {
            return super.getResources();
        }
        Resources resources = LoadResourcesUtils.getResources(getApplication());
        if (resources == null) {
            return super.getResources();
        }
        return resources;
    }
}
